<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Context Free LALR1 compiler: src/contextFree/grammar/Production.java Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Context Free LALR1 compiler
   &#160;<span id="projectnumber">1.1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.8.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="dynsections.js"></script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Packages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('_production_8java.html','');
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">src/contextFree/grammar/Production.java</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="keyword">package </span>contextFree.grammar;
<a name="l00002"></a>00002 
<a name="l00003"></a>00003 <span class="keyword">import</span> inputParser.SplitInSymbols;
<a name="l00004"></a>00004 
<a name="l00005"></a>00005 <span class="keyword">import</span> java.util.LinkedList;
<a name="l00006"></a>00006 <span class="keyword">import</span> java.util.List;
<a name="l00007"></a>00007 
<a name="l00008"></a><a class="code" href="classcontext_free_1_1grammar_1_1_production.html">00008</a> <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="classcontext_free_1_1grammar_1_1_production.html">Production</a> {
<a name="l00009"></a>00009 
<a name="l00010"></a>00010                 <span class="keyword">private</span> String left,right;
<a name="l00011"></a>00011         <span class="keyword">private</span> List&lt;String&gt; leftSimbols;
<a name="l00012"></a>00012         <span class="keyword">private</span> List&lt;String&gt; rightSimbols;
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 
<a name="l00015"></a>00015         <span class="keyword">public</span> <a class="code" href="classcontext_free_1_1grammar_1_1_production.html">Production</a>(){
<a name="l00016"></a>00016                 leftSimbols=null;
<a name="l00017"></a>00017                 rightSimbols=null;
<a name="l00018"></a>00018         }
<a name="l00026"></a><a class="code" href="classcontext_free_1_1grammar_1_1_production.html#aa793940d0a65f644495141b4fe4a86c0">00026</a>         <span class="keyword">public</span> <a class="code" href="classcontext_free_1_1grammar_1_1_production.html#aa793940d0a65f644495141b4fe4a86c0" title="Creates an object production and initialize it&#39;s rightSimbolsList.">Production</a>(List&lt;String&gt; lt, List&lt;String&gt; rt){
<a name="l00027"></a>00027                 leftSimbols=lt;
<a name="l00028"></a>00028                 rightSimbols=rt;
<a name="l00029"></a>00029         }
<a name="l00030"></a>00030        
<a name="l00038"></a><a class="code" href="classcontext_free_1_1grammar_1_1_production.html#a1db3c4e260abdcac50a8425cc9bd901f">00038</a>         <span class="keyword">public</span> <a class="code" href="classcontext_free_1_1grammar_1_1_production.html#a1db3c4e260abdcac50a8425cc9bd901f" title="Create a Complete production representation.">Production</a>(String lt, String rt){
<a name="l00039"></a>00039                 left=lt;
<a name="l00040"></a>00040                 right=rt;
<a name="l00041"></a>00041                 leftSimbols= <span class="keyword">new</span> LinkedList&lt;String&gt;();
<a name="l00042"></a>00042                 rightSimbols = <span class="keyword">new</span> LinkedList&lt;String&gt;();
<a name="l00043"></a>00043                 leftSimbols.add(lt);
<a name="l00044"></a>00044                 rightSimbols.add(rt);
<a name="l00045"></a>00045          }
<a name="l00046"></a>00046  
<a name="l00057"></a><a class="code" href="classcontext_free_1_1grammar_1_1_production.html#a70571ea099db67d650e87f0de16d684b">00057</a>         <span class="keyword">public</span> <a class="code" href="classcontext_free_1_1grammar_1_1_production.html#a70571ea099db67d650e87f0de16d684b" title="Create a Complete production representation.">Production</a>(String lt, String rt,List&lt;String&gt; V,List&lt;String&gt; T) <span class="keywordflow">throws</span> InterruptedException{
<a name="l00058"></a>00058                 leftSimbols=<span class="keyword">new</span> LinkedList&lt;String&gt;();
<a name="l00059"></a>00059                 rightSimbols=<span class="keyword">new</span> LinkedList&lt;String&gt;();
<a name="l00060"></a>00060                 List&lt;String&gt; symbols = <span class="keyword">new</span> LinkedList&lt;String&gt;();
<a name="l00061"></a>00061                 symbols.addAll(T);
<a name="l00062"></a>00062                 symbols.addAll(V);
<a name="l00063"></a>00063                         Runnable rtObj = <span class="keyword">new</span> <a class="code" href="classinput_parser_1_1_split_in_symbols.html" title="Split the input string in symbols list.">SplitInSymbols</a>(rt,this.rightSimbols,symbols);  <span class="comment">//Splitta la stringa in lista di simboli in base</span>
<a name="l00064"></a>00064                         Runnable ltObj = <span class="keyword">new</span> <a class="code" href="classinput_parser_1_1_split_in_symbols.html" title="Split the input string in symbols list.">SplitInSymbols</a>(lt,this.leftSimbols,symbols);
<a name="l00065"></a>00065                         Thread threadR = <span class="keyword">new</span> Thread(rtObj);
<a name="l00066"></a>00066                         Thread threadL = <span class="keyword">new</span> Thread(ltObj);
<a name="l00067"></a>00067                         threadR.start();
<a name="l00068"></a>00068                         threadL.start();        
<a name="l00069"></a>00069                         threadL.join();                                                                                                 <span class="comment">//attende il completamento</span>
<a name="l00070"></a>00070                         threadR.join();
<a name="l00071"></a>00071     }
<a name="l00072"></a>00072         
<a name="l00077"></a><a class="code" href="classcontext_free_1_1grammar_1_1_production.html#aff0ed3fbde7f7a476a993936c27ddef7">00077</a>         <span class="keyword">public</span> List&lt;String&gt; <a class="code" href="classcontext_free_1_1grammar_1_1_production.html#aff0ed3fbde7f7a476a993936c27ddef7">getLeftSimbols</a>() {
<a name="l00078"></a>00078                 <span class="keywordflow">return</span> leftSimbols;
<a name="l00079"></a>00079         }
<a name="l00080"></a>00080 
<a name="l00081"></a>00081         <span class="keyword">public</span> <span class="keywordtype">void</span> setLeftSimbols(List&lt;String&gt;lt) {
<a name="l00082"></a>00082                 this.leftSimbols =lt;
<a name="l00083"></a>00083         }
<a name="l00084"></a>00084 
<a name="l00085"></a>00085         <span class="keyword">public</span> List&lt;String&gt; getRightSimbols() {
<a name="l00086"></a>00086                 <span class="keywordflow">return</span> rightSimbols;
<a name="l00087"></a>00087         }
<a name="l00088"></a>00088 
<a name="l00089"></a>00089         <span class="keyword">public</span> <span class="keywordtype">void</span> setRightSimbols(List&lt;String&gt;rt) {
<a name="l00090"></a>00090                 this.rightSimbols =rt;
<a name="l00091"></a>00091         }
<a name="l00092"></a>00092 
<a name="l00093"></a>00093         <span class="keyword">public</span> String getLeft(){
<a name="l00094"></a>00094                 <span class="keywordflow">if</span>(left==null){
<a name="l00095"></a>00095                 this.left = this.leftSimbols.toString().replaceAll(<span class="stringliteral">&quot;[\\[\\],]&quot;</span>, <span class="stringliteral">&quot;&quot;</span>);
<a name="l00096"></a>00096                 }
<a name="l00097"></a>00097                 <span class="keywordflow">return</span> this.left;
<a name="l00098"></a>00098         }
<a name="l00099"></a>00099         
<a name="l00100"></a>00100         <span class="keyword">public</span> String getRight() {
<a name="l00101"></a>00101                 <span class="keywordflow">if</span>(right==null){
<a name="l00102"></a>00102                 this.right= this.rightSimbols.toString().replaceAll(<span class="stringliteral">&quot;[\\[\\],]&quot;</span>, <span class="stringliteral">&quot;&quot;</span>);
<a name="l00103"></a>00103                 }
<a name="l00104"></a>00104                                 <span class="keywordflow">return</span> this.right;
<a name="l00105"></a>00105         }
<a name="l00109"></a>00109         @Override
<a name="l00110"></a><a class="code" href="classcontext_free_1_1grammar_1_1_production.html#a43d78cd85446efbbffe59a2278c410d1">00110</a>         <span class="keyword">public</span> String <a class="code" href="classcontext_free_1_1grammar_1_1_production.html#a43d78cd85446efbbffe59a2278c410d1" title="return a formatted string in the form axioms :: = expression">toString</a>() {
<a name="l00111"></a>00111                 <span class="keywordflow">if</span>(getRight().equals(<span class="stringliteral">&quot; &quot;</span>))
<a name="l00112"></a>00112                         <span class="keywordflow">return</span> getLeft()+ <span class="stringliteral">&quot;::=&quot;</span> + <span class="stringliteral">&quot;eps&quot;</span>;
<a name="l00113"></a>00113                 <span class="keywordflow">else</span>{
<a name="l00114"></a>00114                                 <span class="keywordflow">return</span> getLeft()+ <span class="stringliteral">&quot;::=&quot;</span> +getRight();
<a name="l00115"></a>00115                 }
<a name="l00116"></a>00116         }
<a name="l00117"></a>00117 }
</pre></div></div><!-- contents -->
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><b>Production.java</b>      </li>

    <li class="footer">Generated on Fri Mar 30 2012 21:26:23 for Context Free LALR1 compiler by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.0 </li>
   </ul>
 </div>


</body>
</html>
